package org.example.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.dao.ExamPaperDao;
import org.example.entity.ExamPaperEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExamPaperInqServiceImpl extends ServiceImpl<ExamPaperDao, ExamPaperEntity> implements ExamPaperInqService {

    @Autowired
    private ExamPaperDao examPaperDao;

    @Override
    public List<ExamPaperEntity> getAllExamPapers() {
        return examPaperDao.selectList(null);  // 查询所有试卷
    }

    @Override
    public ExamPaperEntity getExamPaperById(Integer examId) {
        return examPaperDao.selectById(examId);  // 根据ID查询试卷
    }

    @Override
    public List<ExamPaperEntity> getExamPaperByName(String exampaperName) {
        return examPaperDao.selectList(
                new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<ExamPaperEntity>().like("exam_name", exampaperName));  // 根据名称模糊查询试卷
    }
}
